$(function() {
	var download = $("#download");		

	function downloadFile(url) {

		var fileReader = new FileReader();
		fileReader.ready
		$.ajax({
          type:'GET',
          url:'pdfdata/doc-4/form_xmldata_0',
          resDataType:'blob',  
          imgType:'x',       
          success:function(resText,resXML){  
          	 var blob = oReq.response;
            console.log(window.URL)   
            var oSourceBuffer, oMediaSource = new MediaSource();
            var objectUrl = window.URL.createObjectURL(oMediaSource );

            var alink = $('<a></a>');
            alink.attr("download", objectUrl);
            $('body').append(alink);
            alink.click();
          },
          fail:function(err){
            console.log(err)
          }
        });       
      }

		download.on("click", function() {
			downloadFile('pdfdata/doc-4/form_xmldata_0');
			//for (; oPop.document.readyState != "complete";) {
			//	if (oPop.document.readyState == "complete") break;
			//}
			//oPop.document.execCommand("SaveAs");
			//oPop.close();
		});
	});